<template>
    <historicDetail class="wh-100" v-if="showHistory" @close="showHistory = false" :idCard="idCard" :type="historyType"/>

    <div class="wh-100 d-flex" v-else>
        <div  :class="showRight ? 'w-80' : 'w-100'" class="h-100 card" style="background-color: white">
            <div class="mt-8 mb-8  d-flex-between-center" >
                <div  class=" h-100 d-flex-align-center">
                    <Button @click="getDataList" >刷新</Button>
                    <Button type="dashed" @click="openTip=!openTip">{{ openTip ? "关闭提示" : "开启提示" }}</Button>
                    <Button v-loading="exportingSelect" @click="dropExportSelect">导出所选数据</Button>
                    <Button v-loading="exportingAll" @click="dropExportAll">导出全部数据</Button>
                    <Button v-loading="exportingSearch" @click="dropExportSearch" class="mr-auto">下载当前查询数据</Button>
                </div>
                <Button class="mr-8" :icon="showRight?`ios-arrow-forward`:`ios-arrow-back`"
                        @click.native="showRight =!showRight"
                        type="primary">
                </Button>
            </div>
            <div v-show="openTip">
                <Alert show-icon>
                    已选择 <span class="select-count">{{ selectList.length }}</span> 项
                    <a class="select-clear" @click="clearSelectAll">清空</a>
                </Alert>
            </div>
            <div v-ref-height="refHeight" class="h-80 w-100">
                <div v-if="loading" class="wh-100 d-flex-around-center">
                    <Spin></Spin>
                </div>
                <div v-else class="wh-100">
                    <el-table
                        :v-loading="listloading"
                        border
                        :columns="tableColumns"
                        :data="tableData"
                        ref="table"
                        sortable="custom"
                        empty-text="暂无数据"
                        :height="refHeight.value"
                        @selection-change="changeSelect"
                    >
                        <!--<template slot-scope="{ row, index }" slot="needReport">
                            <div class="wh-100">
                                <span v-if="row.needReport == 0" >未上报</span>
                                <span v-if="row.needReport == 1" >已上报</span>
                            </div>
                        </template>-->
                        <el-table-column type="selection" width="60" align="center"></el-table-column>
                        <el-table-column type="index" label="序号" width="70" align="center"></el-table-column>
                        <el-table-column v-for="column in tableColumns" :key="column.key" :prop="column.key" :label="column.title" :sortable="column.sortable" :width="column.width" :min-width="column.minWidth" :fixed="column.fixed">
                            <template slot-scope="scope">
                                <div v-if="column.key == 'needReport'">
                                    <div class="wh-100">
                                        <span v-if="scope.row.needReport == 0">未上报</span>
                                        <span v-if="scope.row.needReport == 1">已上报</span>
                                    </div>
                                </div>
                                <div v-else-if="column.key == 'importFlag'">
                                    <span v-if="scope.row.importFlag == 0">学生填报</span>
                                    <span v-else-if="scope.row.importFlag == 1">学校导入</span>
                                    <span v-else-if="scope.row.importFlag == 2">学院修改</span>
                                    <span v-else-if="scope.row.importFlag == 3">学校修改</span>
                                </div>
                                <div v-else-if="column.key == 'status'">
                                    <div class="wh-100">
                                    <span v-if="scope.row.status == 0">未填报</span>
                                    <span v-if="scope.row.status == 1">已填报</span>
                                    </div>
                                </div>
                                <div v-else-if="column.key == 'xlcc'">
                                    <div>{{ xlValue(scope.row[column.key]) }}</div>
                                </div>
                                <div v-else-if="column.key == 'pyfsCode'">
                                    <div>{{ pyfsCodeValue(scope.row[column.key]) }}</div>
                                </div>
                                <div v-else-if="column.key == 'onetype'">
                                    <div>{{ oneTypeValue(scope.row[column.key]) }}</div>
                                </div>
                                <div v-else-if="column.key == 'type'">
                                    <div>{{ jyTypeValue(scope.row[column.key]) }}</div>
                                </div>
                                <div v-else-if="column.key == 'dwxz'">
                                    <div>{{ dwxzValue(scope.row[column.key]) }}</div>
                                </div>
                                <div v-else-if="column.key == 'dwhy'">
                                    <div>{{ dwhyValue(scope.row[column.key]) }}</div>
                                </div>
                                <div v-else-if="column.key == 'dwszd'">
                                    <div>{{ dwszdValue(scope.row[column.key]) }}</div>
                                </div>
                                <div v-else-if="column.key == 'gzzwlb'">
                                    <div>{{ gzzwlbValue(scope.row[column.key]) }}</div>
                                </div>
                                <div v-else-if="column.key == 'action'">
                                    <div>
                                    <a style="display: 'inline-block'" @click="selectRow(scope.row)">查看</a>
                                    <Divider type="vertical" />
                                    <a style="display: 'inline-block'" @click="history(scope.row)">历史</a>
                                    </div>
                                </div>
                                <div v-else>{{ scope.row[column.key] }}</div>
                            </template>
                        </el-table-column>
                    </el-table>
                    <!-- <div v-else  class="wh-100">
                        <NoData class="wh-100"></NoData>
                    </div> -->
                </div>
            </div>
            <div  class="w-100 h-10 d-flex-around-center pt-8">
                <Page :current="searchForm.pageNumber"
                      :total="searchForm.total"
                      :page-size="searchForm.pageSize"
                      @on-change="changePage"
                      @on-page-size-change="changePageSize"
                      :page-size-opts="[10,20,50,100,200]"
                      size="small" show-total
                      show-elevator
                      show-sizer>
                </Page>
            </div>
        </div>
        <div v-show="showRight"   class="w_20-12 rightStyle h-100  ml-12 card" >
            <div v-if="isSearch" class="wh-100 pl-8 pr-8">
                <div  class=" pt-12 fs-16  fw-6 ">
                    查询区
                </div>
                <div ><!--class="mt-52"-->
                    <Form ref="searchForm" :model="searchForm"  :label-width="labelWidth">
                        <FormItem label="姓名" prop="xm" class=" w-100">
                            <Input type="text" v-model="searchForm.name" placeholder="请输入姓名" clearable style="width: 100%"/>
                        </FormItem>
                        <FormItem label="考生号" prop="ksh" class=" w-100">
                            <Input type="text" v-model="searchForm.ksh" placeholder="请输入考生号" clearable style="width: 100%"/>
                        </FormItem>
                        <FormItem label="学号" prop="xh" class=" w-100">
                            <Input type="text" v-model="searchForm.xh" placeholder="请输入学号" clearable style="width: 100%"/>
                        </FormItem>
                        <FormItem label="身份证号" prop="sfzh" class=" w-100">
                            <Input type="text" v-model="searchForm.idCard" placeholder="请输入身份证号" clearable style="width: 100%"/>
                        </FormItem>
                        <FormItem v-if='resource === "1" || resource === "0"' class=" w-100" label="学校代码" prop="schoolCode">
                            <Input type="text" v-model="searchForm.schoolCode" placeholder="请输入学校代码" clearable style="width: 100%"/>
                        </FormItem>
                        <FormItem v-if='resource === "1" || resource === "0"' label="学校名称" prop="schoolName" class=" w-100">
                            <Input type="text" v-model="searchForm.schoolName" placeholder="请输入学校名称" clearable
                                   style="width: 100%"/>
                        </FormItem>
                        <FormItem label="学院名称" prop="college" class=" w-100">
                            <Input type="text" v-model="searchForm.college" placeholder="请输入学院名称" clearable
                                   style="width: 100%"/>
                        </FormItem>
                        <FormItem label="学历" prop="xlcc" class=" w-100">
                            <Select v-model="searchForm.xlcc" clearable placeholder="请选择学历" class="w-100">
                                <Option v-for="(item,index) in xlList" :value="item.value" :key="index">{{ item.title }}</Option>
                            </Select>
                        </FormItem>
                        <FormItem label="培养方式" prop="pyfsCode" class=" w-100">
                            <Select v-model="searchForm.pyfsCode" clearable filterable class="w-100">
                                <Option v-for="(item,index) in pyfsList" :value="item.value" :key="index">{{ item.title }}</Option>
                            </Select>
                        </FormItem>
                        <FormItem label="就业状况" prop="oneType" class=" w-100">
                            <Select v-model="searchForm.oneType" clearable filterable class="w-100">
                                <Option v-for="(item,index) in oneTypeDicts" :value="item.value" :key="index">{{ item.title }}</Option>
                            </Select>
                        </FormItem>
                        <FormItem label="单位名称" prop="dwmc" class=" w-100">
                            <Input type="text" v-model="searchForm.dwmc" placeholder="请输入单位名称" clearable
                                   style="width: 100%"/>
                        </FormItem>
                        <FormItem label="单位性质" prop="dwxz" class=" w-100">
                            <Select v-model="searchForm.dwxz" clearable filterable class="w-100">
                                <Option v-for="(item,index) in unitNatureDicts" :value="item.value" :key="index">{{ item.title }}</Option>
                            </Select>
                        </FormItem>
                        <FormItem label="单位行业" prop="dwhy" class=" w-100">
                            <Select v-model="searchForm.dwhy" clearable filterable class="w-100">
                                <Option v-for="(item,index) in unitIndustryDicts" :value="item.value" :key="index">{{ item.title }}</Option>
                            </Select>
                        </FormItem>
                        <FormItem label="去向上报状态" prop="needReport" class=" w-100">
                            <Select v-model="searchForm.needReport" clearable placeholder="去向上报状态" class="w-100">
                                <Option value="0">未上报</Option>
                                <Option value="1">已上报</Option>
                            </Select>
                        </FormItem>

                        <FormItem label="去向填报状态" prop="status" class=" w-100">
                            <Select v-model="searchForm.status" clearable placeholder="去向填报状态" class="w-100">
                                <Option value="0">未填报</Option>
                                <Option value="1">已填报</Option>
                            </Select>
                        </FormItem>


                        <FormItem label="数据来源" prop="importFlag" class=" w-100">
                            <Select v-model="searchForm.importFlag" clearable placeholder="请选择数据来源" class="w-100">
                                <Option value="0">学生填报</Option>
                                <Option value="1">学校导入</Option>
                                <Option value="2">学院修改</Option>
                                <Option value="3">学校修改</Option>
                            </Select>
                        </FormItem>
                        <FormItem class="box-key br">
                        <Button  type="primary" icon="ios-search" @click="search">搜索</Button>
                            <Button  @click="resetForm">重置</Button>
                        </FormItem>
                    </Form>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import  NoData from '@/components/NoData.vue';
import { exportSearchJyqxResult, exportSelectJyqxResult, getPageBysJyqxResultData } from '../../../api/bys/jyqx/jyqx';
import { employmentCategoryAPI, newAllProvincialDataApi, obtainEmploymentStatusDataAPI } from '../../../api/bys';
import { getDictDataByType } from '../../../api';
// import { getAllGwschoolCodeList } from '../../../api/gwschoolCode';
import { areaDataApi } from '../../../api/common';
import Cookies from 'js-cookie';
import historicDetail from '../../activiti/historic-detail/historicDetail.vue';


export default {
    name: 'jyqxInfoManage',
    components: {
        NoData,
        historicDetail
    },
    data() {
        return {
            listloading: false,
            labelWidth: 100,
            historyType: '',
            idCard: '',
            showHistory: false,
            refHeight:{value:0},
            openTip: true, // 显示提示
            exportingSearch: false,
            exportingSelect: false,
            exportingAll: false,
            showRight: true,
            resource: '',
            loading: true,
            isSearch: true,
            selectList: [], // 多选数据
            tableData:  [], // 表格数据
            tableColumns: [],
            tableColumns_1: [
                // 表头
                // {
                //     type: 'selection',
                //     width: 60,
                //     align: 'center'
                // },
                // {
                //     type: 'index',
                //     title: '序号',
                //     width: 70,
                //     align: 'center'
                // },
                {
                    title: '数据来源',
                    minWidth: 100,
                    key: 'importFlag', // 0是学生填报 1是学校导入 2是学院修改 3是学校修改
                    sortable: false,
                    render: (h, params) => {
                        if (params.row.importFlag == 0) {
                            return h('span', '学生填报');
                        } else if (params.row.importFlag == 1) {
                            return h('span', '学校导入');
                        } else if (params.row.importFlag == 2) {
                            return h('span', '学院修改');
                        } else if (params.row.importFlag == 3) {
                            return h('span', '学校修改');
                        }
                    }
                },
                {
                    title: '去向状态',
                    minWidth: 100,
                    key: 'status', // 0未填报 1已填报
                    sortable: false,
                    render: (h, params) => {
                        if (params.row.status == 0) {
                            return h('span', '未填报');
                        } else if (params.row.status == 1) {
                            return h('span', '已填报');
                        }
                    }
                },
                /* {
                     title: '数据上报状态',
                     minWidth: 100,
                     key: 'needReport', // 0需要上报 1不需要上报(已上报)
                     sortable: false,
                     render: (h, params) => {
                         if (params.row.needReport == 0) {
                             return h('span', '待上报');
                         } else if (params.row.needReport == 1) {
                             return h('span', '已上报');
                         }
                     }
                 },*/
                {
                    title: '学校名称',
                    key: 'schoolName',
                    minWidth: 200,
                    sortable: false
                },
                {
                    title: '院系名称',
                    key: 'college',
                    minWidth: 180,
                    sortable: false
                },
                {
                    title: '专业',
                    key: 'profession',
                    minWidth: 180,
                    sortable: false
                },
                {
                    title: '考生号',
                    key: 'ksh',
                    minWidth: 160,
                    sortable: false
                },
                {
                    title: '姓名',
                    key: 'name',
                    minWidth: 100,
                    sortable: false
                },
                {
                    title: '身份证号',
                    key: 'idCard',
                    minWidth: 180,
                    sortable: false
                },
                {
                    title: '学号',
                    key: 'xh',
                    minWidth: 140,
                    sortable: false
                },
                {
                    title: '学历',
                    key: 'xlcc',
                    minWidth: 180,
                    sortable: false,
                    render: (h, params) => {
                        return h('span', this.xlList.find(item => item.value === params.row.xlcc).title);
                    }
                },
                {
                    title: '培养方式',
                    key: 'pyfsCode',
                    minWidth: 120,
                    sortable: false,
                    render: (h, params) => {
                        let dict = this.pyfsList.find(item => item.value === params.row.pyfsCode);
                        return h('div', dict ? dict.title : '');
                    }
                },
                {
                    title: '就业状况',
                    key: 'onetype',
                    minWidth: 120,
                    sortable: false,
                    render: (h, params) => {
                        if (params.row.onetype === '5') {
                            return h('span', '暂未登记或上报');
                        } else {
                            let arr = this.oneTypeDicts.filter(e => e.value == params.row.onetype);
                            return h('span', arr && arr.length > 0 ? arr[0].title : '');
                        }
                    }
                },
                {
                    title: '就业类别',
                    key: 'type',
                    minWidth: 700,
                    sortable: false,
                    render: (h, params) => {
                        let arr = this.jytype.filter(e => e.profCode == params.row.type);
                        return h('span', arr && arr.length > 0 ? arr[0].title : '');
                    }
                },
                {
                    title: '单位名称',
                    key: 'dwmc',
                    minWidth: 250,
                    sortable: false
                },
                {
                    title: '单位统一社会信用代码',
                    key: 'tyshxycode',
                    minWidth: 180,
                    sortable: false
                },
                {
                    title: '单位性质',
                    key: 'dwxz',
                    minWidth: 120,
                    sortable: false,
                    render: (h, params) => {
                        let arr = this.unitNatureDicts.filter(e => e.value == params.row.dwxz);
                        return h('span', arr && arr.length > 0 ? arr[0].title : '');
                    }
                },
                {
                    title: '单位行业',
                    key: 'dwhy',
                    minWidth: 280,
                    sortable: false,
                    render: (h, params) => {
                        let arr = this.unitIndustryDicts.filter(e => e.value == params.row.dwhy);
                        return h('span', arr && arr.length > 0 ? arr[0].title : '');
                    }
                },
                {
                    title: '单位所在地',
                    key: 'dwszd',
                    minWidth: 150,
                    sortable: false,
                    render: (h, params) => {
                        if(params.row.dwszd && params.row.dwszd.indexOf(',') != -1){
                            let arr = this.areaList.filter(item => item.code == params.row.dwszd.split(',')[2]);
                            return h('span', arr && arr.length > 0 ? arr[0].allName : '');
                        }else{
                            return h('span', '');

                        }
                    }
                },
                {
                    title: '工作职位类别',
                    key: 'gzzwlb',
                    minWidth: 180,
                    sortable: false,
                    render: (h, params) => {
                        let arr = this.jobPositionCategoryDicts.filter(e => e.value == params.row.gzzwlb);
                        return h('span', arr && arr.length > 0 ? arr[0].title : '');
                    }
                },
                {
                    title: '单位联系人',
                    key: 'dwlxr',
                    minWidth: 120,
                    sortable: false
                },
                {
                    title: '单位电话',
                    key: 'lxrdw',
                    minWidth: 180,
                    sortable: false
                },
                {
                    title: '联系人手机',
                    key: 'dwdh',
                    minWidth: 180,
                    sortable: false
                },
                {
                    title: '单位电子邮箱',
                    key: 'lxremail',
                    minWidth: 200,
                    sortable: false
                },
                {
                    title: '联系人传真',
                    key: 'lxrfax',
                    minWidth: 180,
                    sortable: false
                },
                {
                    title: '单位地址',
                    key: 'dwdz',
                    minWidth: 350,
                    sortable: false
                },
                {
                    title: '单位邮编',
                    key: 'dwyb',
                    minWidth: 120,
                    sortable: false
                },
                {
                    title: '协议书编号',
                    key: 'xysbh',
                    minWidth: 120,
                    sortable: false
                },
                {
                    title: '转正后薪资（元/月）',
                    key: 'zzhxz',
                    minWidth: 160,
                    sortable: false
                },
                {
                    title: '留学国家/地区',
                    key: 'lxgjdq',
                    minWidth: 120,
                    sortable: false
                },
                {
                    title: '境外学校中文名称',
                    key: 'jwxxzwmc',
                    minWidth: 120,
                    sortable: false
                },
                {
                    title: '留学院校外文名称',
                    key: 'jwxxwwmc',
                    minWidth: 120,
                    sortable: false
                },
                {
                    title: '留学专业中文名称',
                    key: 'lxzyzwmc',
                    minWidth: 120,
                    sortable: false
                },
                {
                    title: '留学专业外文名称',
                    key: 'lxzywwmc',
                    minWidth: 120,
                    sortable: false
                },
                {
                    title: '留学学历',
                    key: 'lxxl',
                    minWidth: 120,
                    sortable: false
                },
                {
                    title: '更新时间',
                    key: 'updateTime',
                    minWidth: 180,
                    sortable: false
                },
                {
                    title: "去向上报状态",
                    slot: "needReport",
                    key: "needReport",
                    align: "center",
                    width: 120,
                    fixed:"right",
                },
                {
                    title: '操作',
                    key: 'action',
                    align: 'center',
                    width: 200,
                    fixed: 'right',
                    render: (h, params) => {

                        // if (params.row.onetype === '5') {
                        //     return h();
                        // }

                        return h("div", [
                            h(
                                "a",
                                {
                                    // style: {
                                    //     display: this.hasPermission(this, 'edit') ? 'inline-block' : "none",
                                    // },
                                    style: {
                                        display:  'inline-block',
                                    },
                                    on: {
                                        click: () => {
                                            this.selectRow(params.row);
                                        }
                                    }
                                },
                                "查看"
                            ),
                            h("Divider", {
                                props: {
                                    type: "vertical",
                                },
                            }),
                            h(
                                "a",
                                {
                                    style: {
                                        display:  'inline-block',
                                    },
                                    on: {
                                        click: () => {
                                            this.history(params.row);
                                        }
                                    }
                                },
                                "历史"
                            ),
                        ]);

                    }
                }
            ],
            searchForm: { // 搜索框初始化对象
                pageNumber: 1, // 当前页数
                pageSize: 50, // 页面大小
                total:0,
            },
            locationOfTheUnitList: [], // 单位所在地列表
            unitNatureDicts: [], // 单位性质列表
            // gwSchoolCodeList: [], // 高校代码列表
            pyfsList: [], // 培养方式列表
            oneTypeDicts: [], // 就业状况列表
            unitIndustryDicts:[], // 单位行业列表
            jobPositionCategoryDicts:[], // 工作职位类别列表
            jytype:[], // 就业类别列表
            areaList:[], // 地区列表
            xlList:[], // 学历层次列表
        }
    },
    beforeDestroy() {
        window.removeEventListener('resize',this.onRestWindow)
    },
    async mounted() {
        this.onRestWindow()
        window.addEventListener('resize',this.onRestWindow)

        this.resource = JSON.parse(Cookies.get('userInfo')).resource;
        // this.loading = true;
        this.getDataList();
        this.dictData()
        await this.getareaData()
    },
    methods: {
        xlValue(data) {
            let dict = this.xlList.find(item => item.value === data);
            return dict ? dict.title : ''
        },
        pyfsCodeValue(data) {
            let dict = this.pyfsList.find(item => item.value === data);
            return dict ? dict.title : ''
        },
        oneTypeValue(data) {
            if (data === '5') {
                return '暂未登记或上报'
            } else {
                let arr = this.oneTypeDicts.filter(e => e.value == data);
                return arr && arr.length > 0 ? arr[0].title : ''
            }
        },
        jyTypeValue(data) {
            let arr = this.jytype.filter(e => e.profCode == data);
            return arr && arr.length > 0 ? arr[0].title : ''
        },
        dwxzValue(data) {
            let arr = this.unitNatureDicts.filter(e => e.value == data);
            return arr && arr.length > 0 ? arr[0].title : ''
        },
        dwhyValue(data) {
            let arr = this.unitIndustryDicts.filter(e => e.value == data);
            return arr && arr.length > 0 ? arr[0].title : ''
        },
        dwszdValue(data) {
            if (data && data.indexOf(',') != -1) {
                let arr = this.areaList.filter(item => item.code == data.split(',')[2]);
                return arr && arr.length > 0 ? arr[0].allName : ''
            } else {
                return ''

            }
        },
        gzzwlbValue(data) {
        let arr = this.jobPositionCategoryDicts.filter(e => e.value == data);
        return arr && arr.length > 0 ? arr[0].title : ''
        },
        onRestWindow() {
            this.tableColumns = this.restTableCellWidth(this.tableColumns_1)
            this.labelWidth = this.searchLabelWidth(this.labelWidth)
        },
        selectRow(row){
            console.log(row, 'row');
            this.$router.push({ name: 'JyqxManageEdit', params: { row: row } ,query: {type:'1'} });
        },
        history(v) {
            console.log(v, 'vvvv');
            if (!v.idCard) {
                this.$Message.warning({
                    content: '暂无历史',
                    duration: 5,
                    closable: true
                });
                this.idCard = v.idCard;
                return;
            }
            this.showHistory = true;
            this.historyType = '2';
            this.idCard = v.idCard;
        },
        dropExportSearch() {
            this.exportingSearch = true;
            exportSearchJyqxResult(this.searchForm).then(res => {
              this.exportingSearch = false;
              const blob = new Blob([res], {type: 'charset=utf-8'});
              let url = window.URL.createObjectURL(blob);
              const link = document.createElement('a');
              link.style.display = 'none';
              link.href = url;
              link.setAttribute('download', '去向信息.xlsx');
              document.body.appendChild(link);
              link.click();
              document.body.removeChild(link); // 删除节点
              window.URL.revokeObjectURL(url); //释放该 url
            });
        },
        dropExportSelect() {
            let ids = [];
            this.selectList.forEach(function (e) {
              ids.push(e.id)
            });
            this.exportingSelect = true;
            exportSelectJyqxResult({ids: ids}).then(res => {
              this.exportingSelect = false;
              // type的格式可以可以设置，可以把appcation/json设置进去，然后设置导出的类型
              const blob = new Blob([res], {type: 'charset=utf-8'});
              let url = window.URL.createObjectURL(blob);

              const link = document.createElement('a');
              link.style.display = 'none';
              link.href = url;
              link.setAttribute('download', '去向信息.xlsx');
              document.body.appendChild(link);
              link.click();
              document.body.removeChild(link); // 删除节点
              window.URL.revokeObjectURL(url); //释放该 url
            });
            console.log(ids);
        },

        dropExportAll() {
            this.exportingAll = true;
            exportSelectJyqxResult().then(res => {
              this.exportingAll = false;
              // type的格式可以可以设置，可以把appcation/json设置进去，然后设置导出的类型
              const blob = new Blob([res], {type: 'charset=utf-8'});
              let url = window.URL.createObjectURL(blob);
              const link = document.createElement('a');
              link.style.display = 'none';
              link.href = url;
              link.setAttribute('download', '去向信息.xlsx');
              document.body.appendChild(link);
              link.click();
              document.body.removeChild(link); // 删除节点
              window.URL.revokeObjectURL(url); //释放该 url
            });
        },
        resetForm(){
            this.searchForm = { // 搜索框初始化对象
                pageNumber: 1, // 当前页数
                pageSize: 50, // 页面大小
                total:0,
            };
            this.getDataList();
        },
        search(){
            this.searchForm.pageNumber = 1;
            this.getDataList();
        },
        async getareaData() {
            let res = await areaDataApi()
            if(res.code === 200){
                this.areaList = res.result
                console.log("this.areaList",this.areaList)
            }
        },
        dictData(){
            employmentCategoryAPI().then(res => {
                if (res.success) {
                    this.jytype = res.result;
                }
            });

            newAllProvincialDataApi().then(res => {
                this.locationOfTheUnitList = res.result;
                console.log('this.locationOfTheUnitList', res);
                console.log('this.locationOfTheUnitList', this.locationOfTheUnitList);
            });

            //单位性质
            getDictDataByType('unit-nature').then(res => {
                if (res.success) {
                    this.unitNatureDicts = res.result;
                }
            });/*
            // 国外学校代码
            getAllGwschoolCodeList().then(res => {
                if (res.success) {
                    this.gwSchoolCodeList = res.result;
                }
            });*/
            //培养方式
            getDictDataByType('training-methods').then(res => {
                if (res.success) {
                    this.pyfsList = res.result;
                }
            });
            //获取就业状况数据
            obtainEmploymentStatusDataAPI()
                .then(res => {
                    if (res.success) {
                        this.oneTypeDicts = res?.result || [];
                        this.oneTypeDicts.push({ title: "暂未登记或上报", value: 5 });
                    }
                })
                .catch(e => {
                    console.log(e);
                });

            //学历层次
            getDictDataByType("eduLevelType").then(res=>{
              if (res.success) {
                this.xlList = res.result;
              }
            })

            //单位行业
            getDictDataByType('unit-industry').then(res => {
                if (res.success) {
                    this.unitIndustryDicts = res.result;
                }
            });

            //工作职位类别
            getDictDataByType('job-position-category').then(res => {
                if (res.success) {
                    this.jobPositionCategoryDicts = res.result;
                }
            });
        },
        getDataList(){
            // this.loading = true;
            this.listloading = true
            getPageBysJyqxResultData({ ...this.searchForm }).then(res => {
                console.log("res……", res);
                this.tableData = res.result.list;
                this.searchForm.total = res.result.total;
                this.listloading = false
                this.loading = false;
            })
        },
        changeSelect(e) {
            this.selectList = e;
            console.log("selectList", this.selectList);
        },
        clearSelectAll() {
            this.$refs.table.selectAll(false);
        },
        changePage(v) {
            this.searchForm.pageNumber = v;
            this.getDataList();
        },
        changePageSize(v) {
            this.searchForm.pageSize = v;
            this.getDataList();
        },
    }
};
</script>




<style scoped lang="less">
//form表单间距统一修改
.ivu-form-item {
    margin-bottom: 0.01rem !important;
}

.card{
    background: white;
    transition: box-shadow .3s ease, transform .2s ease;
}
.card:hover {
    box-shadow: 0 4px 8px #23232333;
}
.w_20-12{
    width: calc(20% - 12px);
}

.cml35 {
    margin-left:-35px;
}

@media (max-width: 1920px) {
    /deep/ .ivu-table .ivu-table-fixed-right {
        height: 98% !important;

    }
    /deep/ .ivu-table .ivu-table-fixed-body {
        height: 94% !important;
    }
    /deep/ .ivu-table-body {
        height: 94.2%!important;
    }
}

// 重构样式
/deep/ .ivu-form-item-label{
    display: flex;
    justify-content: right;
    width: 150px !important;
}
/deep/ .ivu-form-item {
    width: 100%;
    margin-bottom: 0.1rem;
    margin-right: 0 !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
/deep/ .ivu-form-item-content {
    width: 100% !important;
    margin-left: 0 ! important;
}
/deep/ .ivu-select {
    width: 100% !important;
}
/deep/ .ivu-date-picker {
    width: 100% !important;
}
/deep/ .br {
    margin-top: 15px;
    bottom: 0.12rem !important;
    .ivu-form-item-content {
        display: flex;
    }
}
/deep/ .ivu-input-type-textarea,/deep/ .ivu-input {
    height: calc(100% - 7px) !important;
}
.flex-1 {
    height: 100%;
}
/deep/ .ivu-drawer-body {
    overflow: hidden;
    .d-flex-align-center {
        height: fit-content !important;
        margin-left: 0 !important;
        justify-content: right;
        box-sizing: border-box;
        padding-right: 7px;
    }
}
.box-key {
    /deep/ .ivu-form-item-content {
        margin-left: 95px !important;
    }
}

</style>
